package lg.minecraft.plugin.cobblemoncore.item.builder;

import com.cobblemon.mod.common.pokemon.Species;
import lg.minecraft.plugin.library.item.ItemProperties;
import org.bukkit.inventory.ItemStack;

import java.util.Map;

/**
 * @author langle__
 * @version 1.0
 */
public class PokemonDynamicItemBuilder extends PokemonPlaceholderItemBuilder {

    private final ItemProperties alternateProperties;

    public PokemonDynamicItemBuilder(ItemProperties primaryProperties, ItemProperties alternateProperties) {
        super(primaryProperties);
        this.alternateProperties = alternateProperties;
    }

    public PokemonDynamicItemBuilder(ItemProperties properties) {
        this(properties, properties);
    }

    @Override
    protected ItemStack build(Map<String, String> map, Object... args) {
        Species species = (Species) args[0];
        boolean flag = (Boolean) args[1];
        ItemProperties selectedProperties = flag ? this.properties : this.alternateProperties;
        return buildBasicItem(selectedProperties, map, species);
    }

    public ItemStack build(Species species, Map<String, String> map, boolean useAlternate) {
        return this.build(map, species, useAlternate);
    }

    @Override
    public ItemStack build(Species species, Map<String, String> map) {
        return this.build(species, map, false);
    }

}
